﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Domain.Core.Specification;
using Domain.MainModule.Entities;

namespace Domain.MainModule.CustomersMTS
{

    public class CustomerMTSNameSpecification: Specification<CustomerMTS>
    {
        /// <summary>
        /// Filtros a definir mas tarde.
        /// </summary>
        
        private string _firstName;
        private string _lastName;
        private string _firstSurname;
        private string _lastSurname;

        public CustomerMTSNameSpecification(string firstName, string lastName, string firstSurname, string lastSurname)
        {
            this._firstName = firstName;
            this._lastName = lastName;
            this._firstSurname = firstSurname;
            this._lastSurname = lastSurname;
        }

        public override System.Linq.Expressions.Expression<Func<CustomerMTS, bool>> SatisfiedBy()
        {
            Specification<CustomerMTS> spec = new TrueSpecification<CustomerMTS>();

            spec &= new DirectSpecification<CustomerMTS>(t => t.IsEnabled);
            
            spec &= new DirectSpecification<CustomerMTS>(t => t.FirstName == this._firstName);
            spec &= new DirectSpecification<CustomerMTS>(t => t.LastName == this._lastName);
            spec &= new DirectSpecification<CustomerMTS>(t => t.FirstSurname == this._firstSurname);
            spec &= new DirectSpecification<CustomerMTS>(t => t.LastSurname == this._lastSurname);


            return spec.SatisfiedBy();

        }
    }
}
